﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;

namespace Meraz.Core.Model
{
    [DataContract]
    [Serializable]
    public class TwitterUser : IEquatable<TwitterUser>
    {
        public TwitterUser() { Tweets = new List<Tweet>(); }
        public TwitterUser(string username) { Name = username; Tweets = new List<Tweet>(); }
        [DataMember]
        [XmlIgnore]
        public long ID { get; set; }

        [DataMember]
        [XmlAttribute()]
        public string Name { get; set; }
        [DataMember]
        [XmlAttribute()]
        public bool IsTopJournalist { get; set; }
        [DataMember]
        [XmlAttribute()]
        public bool IsBlog { get; set; }
        [DataMember]
        [XmlAttribute()]
        public bool IsNewspaper { get; set; }
        [DataMember]
        [XmlAttribute()]
        public bool IsTopPolitical { get; set; }
        [XmlIgnore]
        public List<Tweet> Tweets { get; set; }
        public List<TwitterStudy> TwitterStudies { get; set; }
        public override bool Equals(object obj)
        {
            if (obj != null && obj is TwitterUser)
                return Equals((TwitterUser)obj);
            return false;
        }
        public override int GetHashCode()
        {
            return ID.GetHashCode();
        }
        public bool Equals(TwitterUser other)
        { 
            if (other == null)
                return false;
            return ID.Equals(other.ID);
        }
    }
}
